{% extends extends_template %}

{% block title %}
{% if account %}{{account.name}} - {% endif %}Payments
{% endblock %}

{% block location %}
    <div class="nav"><a href="{% url accounts %}">Accounts</a></div>
	{% if account %}
        <div class="nav"><a href="{% url account_details account_id=account.id %}">{{account.name}}</a></div>
        <div class="nav"><a href="{% url list_account_payments account_id=account.id %}">Payments</a></div>
        {% if from %}
            <div class="nav"><a href="{% url list_account_payments_to_from detail='from' account_id=account.id %}">From {{account.name}}</a></div>
        {% endif %}
        {% if to %}
            <div class="nav"><a href="{% url list_account_payments_to_from detail='to' account_id=account.id %}">To {{account.name}}</a></div>
        {% endif %}
	{% else %}
        <div class="nav"><a href="{% url list_payments %}">Payments</a></div>
        {% if from %}
            <div class="nav"><a href="{% url list_payments_details detail='from' %}">From accounts</a></div>
        {% endif %}
        {% if to %}
            <div class="nav"><a href="{% url list_payments_details detail='from' %}">To accounts</a></div>
        {% endif %}
	{% endif %}
{% endblock %}

{% block content %}
<div id="payments">
    {% if payments %}
        {% if account %}
            {% include 'cli/cli_payment_table.html' with account_linked='True' payments=payments user=account.user payments_caption=payments_caption from=from %}
        {% else %}
            {% include 'cli/cli_payment_table.html' with payments=payments user=user payments_caption=payments_caption from=from %}
        {% endif %}
    {% else %}
    <div>No payments</div>
    {% endif %}
</div>
{% endblock %}
